var async = require("async");
var renderEngin = require("../common/renderEngin");
var Tools = require("../common/tools");
exports.notification_info = function(req, res) {
    use(["public/javascripts/notification_info/init.js", "public/javascripts/service/notification_infoService.js"], function(PageComponent, notification_infoService) {
        var storage = {};
        storage["slider"] = Tools.getPageSliderData("user_center");

        notification_infoService.getMsgList({
            headers: req.headers,
            urlParams: {'refAskBoardId': req.query.id}
        }, function (result) {
            if (result.errorCode == 0) {
                storage["msgList"] = result;
                storage["list"] = result.data.reverse();
                storage["totalResult"] = result.pagination.totalResult;
                storage["totalPage"] = result.pagination.totalPage;
                storage["refAskBoardId"] = req.query.id;
            } else {
                storage["msgList"] = {};
                storage["list"] = [];
                storage["totalResult"] = 0;
                storage["totalPage"] = 0;
                storage["refAskBoardId"] = 0;
            }

            PageComponent = React.createFactory(PageComponent);
            renderEngin.call(res, 'notification_info', PageComponent, storage);
        });
    });
}
